/* gtkmm example Copyright (C) 2002 gtkmm development team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include <memory>
#include <gtkmm/main.h>

#include "defines.h"
#include "examplewindow.h"

using namespace std;

int main(int argc, char *argv[])
{
	Gnome::Conf::init();
	Glib::RefPtr<Gnome::Conf::Client> client =
		Gnome::Conf::Client::get_default_client();

	string s("/apps/hellotechie/hexedit");
	string sDir = s;
	client->add_dir(sDir, Gnome::Conf::CLIENT_PRELOAD_ONELEVEL);
	
	Gtk::Main kit(argc, argv); 
	ExampleWindow window;
	const string dir_path = Glib::get_user_data_dir();

	window.set_icon_from_file(dir_path + "/Hexedit/pixmaps/ethane-sm.png");	 
	window.set_title(APP_NAME);
	sDir.append("/window/x");
	
	int x = client->get_int(sDir);
	if(x < 0) x = DEFAULT_X;
	sDir = s;
	
	sDir.append("/window/y");
	int y = client->get_int(sDir);
	if(y < 0) y = DEFAULT_Y;
	
	window.resize(x, y); 
	Gtk::Main::run(window);
	window.get_size(x, y);
	
	sDir = s;
	sDir.append("/window/x");
	client->set(sDir, x);

	sDir = s;	
	sDir.append("/window/y");
	client->set(sDir, y);

	return 0;
}
